package com.yuanyefu.ModifyDefinition;

import java.awt.*;
import java.beans.PropertyChangeListener;
import java.beans.PropertyEditor;
import java.beans.PropertyEditorSupport;

/**
 * Created by Administrator on 2017/9/16 0016.
 */
public class ContactEditor extends PropertyEditorSupport{

    public void setAsText(String text){
        String[] ss = text.split("[ ]*\\;[ ]*");
        if (ss.length!=3)
            throw new IllegalArgumentException(text);
        Contact contact = new Contact();
        contact.setName(ss[0]);
        contact.setAddress(ss[1]);
        contact.setZip(ss[2]);
        setValue(contact);
    }


}
